package com.zzx.magic.controller;

import com.zzx.magic.entity.BpFeedback;
import com.zzx.magic.entity.BpInterested;
import com.zzx.magic.entity.BusinessPlan;
import com.zzx.magic.service.IBpFeedbackService;
import com.zzx.magic.service.IBpInterestedService;
import com.zzx.magic.service.IBusinessPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 推荐模块
 *
 * @Author Zhangxx
 * @Date 2024/6/12 16:34
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {

    @Autowired
    IBpFeedbackService iBpFeedbackService;

    @Autowired
    IBusinessPlanService iBusinessPlanService;

    @Autowired
    IBpInterestedService iBpInterestedService;

    @RequestMapping("/recommendList")
    public List<BusinessPlan> recommendList(String id) {
        List<BusinessPlan> recommend = iBusinessPlanService.recommend(id);
        return recommend;
    }

    @RequestMapping("/feedback")
    public String feedback(BpFeedback bpFeedback) {
        iBpFeedbackService.insert(bpFeedback);
        return "";
    }

    @RequestMapping("/interested")
    public String interested(BpInterested bpInterested) {
        iBpInterestedService.insert(bpInterested);
        return "";
    }

    @RequestMapping("/interestedList")
    public List<BusinessPlan> interestedList(String id) {
        List<BusinessPlan> list =  iBpInterestedService.interestedList(id);
        return list;
    }

    @RequestMapping("/chat")
    public void chat() {

    }

    @RequestMapping("/buy")
    public String buy(BpInterested bpInterested) {
        iBpInterestedService.insert(bpInterested);
        return "";
    }

    @RequestMapping("/deliverList")
    public List<BusinessPlan> deliverList(String id) {
        List<BusinessPlan> businessPlans = iBpInterestedService.interestedList(id);
        return businessPlans;
    }

}